package spring.boot.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import spring.boot.admin.model.SysMenu;
import spring.boot.admin.service.SysMenuService;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private SysMenuService sysMenuService;

    /**
     * 跳转到主页
     */
    @GetMapping("/")
    @PreAuthorize("true")
    public String index(Model model) {
        //查询主页左侧菜单 tree
        List<SysMenu> menuList = sysMenuService.selectIndexLeftList();
        model.addAttribute("menuList", menuList);
        return "index";
    }
}
